{% extends "front/layout/base.html" %}

{% block scripts %}
    <link href="/static/assets/front/css/bootstrap.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="/static/css/children.css"/>
    <link href="/static/assets/front/css/slick.css" rel="stylesheet"/>
    <link href="/static/assets/front/css/slick-theme.css" rel="stylesheet"/>
    <link href="/static/assets/front/css/style.css" rel="stylesheet"/>
{% endblock %}

{% block content %}
    <!-- 当前位置 -->
    <div class="gonggao bdb_d fix">
        <!-- 时间 -->
        <div class="timebox fc r">
            <script type="text/javascript" src="/static/js/show_date.js"></script>
        </div>
    </div>

    <!-- 子页内容框 -->
    <div class="zy_contentbox">
        <!-- zy_content -->
        <div class="zy_content fix">
            <!-- 左边栏 -->
            <div class="zy_left_con">
                <b></b>
                <!-- 二级菜单 -->
                <div class="zy_twonav">
                    {% block sidebar %}{% endblock %}
                </div>
                <script>document.getElementById("{{ code }}").classList.add("cur")</script>
            </div>

            <!-- 右边内容 -->
            <div class="zy_right_con">
                {% block sub_content %}
                    <!-- 当前位置 -->
                    <div class="zy_title fix">
                        <h2>{{ name }}<i></i></h2>
                    </div>
                    <div class="c_900">
                    {% block maintext %}
                        {% for i in contentPage %}
                            <div class="row">
                                <div style="cursor:pointer" class="col-md-12">
                                    <a href="{% url 'information_service' %}?data=detail&id={{ i.id }}"
                                       target='_blank'>
                                        <blockquote class="blockquote blockquote-red">
                                            {{ i.addTime|date:"Y-m-d" }}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{ i.title }}
                                        </blockquote>
                                    </a>
                                </div>
                            </div>
                        {% endfor %}
                        <!-- END TAB CONTENT -->

                        <!-- 分页部分 -->
                        <div class="pull-left">
                            <label style="padding-top: 15px;font-size: 16px"> &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
                                共 &nbsp {{ number }} &nbsp条
                            </label>
                        </div>

                        <div class="pull-right">
                            <ul class="pagination pagination-lg">
                                {% if has_previous %}
                                    <li>
                                        <a href="{% url 'information_service' %}?data={{ code }}&page={{ previous_page_number }}">
                                            < </a></li>
                                {% endif %}

                                {# 页码号为1永远显示 #}
                                {% if first_page == contentPage_num %}
                                    <li class="active"><a href="{% url 'information_service' %}?data={{ code }}&page=1">1</a>
                                    </li>
                                {% else %}
                                    <li><a href="{% url 'information_service' %}?data={{ code }}&page=1">1</a></li>
                                {% endif %}

                                {% if pages_first > 2 %}
                                    <li><a href="#">...</a></li>
                                {% endif %}

                                {% for pg in pages %}
                                    {% if contentPage_num == pg %}
                                        <li class="active"><a
                                                href="{% url 'information_service' %}?data={{ code }}&page={{ pg }}">{{ pg }}</a>
                                        </li>
                                    {% else %}
                                        <li>
                                            <a href="{% url 'information_service' %}?data={{ code }}&page={{ pg }}">{{ pg }}</a>
                                        </li>
                                    {% endif %}
                                {% endfor %}

                                {#pages最后一个值+1的值小于最大页码号，说明有页码号需要被省略号替换#}
                                {% if pages_last < last_page %}
                                    <li><a href="#">...</a></li>
                                {% endif %}

                                {# 永远显示最后一页的页码号，如果只有一页则前面已经显示了1就不用再显示了 #}
                                {% if last_page != 1 %}
                                    {% if contentPage_num == last_page %}
                                        <li class="active"><a
                                                href="{% url 'information_service' %}?data={{ code }}&page={{ last_page }}">{{ last_page }}</a>
                                        </li>
                                    {% else %}
                                        <li>
                                            <a href="{% url 'information_service' %}?data={{ code }}&page={{ last_page }}">{{ last_page }}</a>
                                        </li>
                                    {% endif %}
                                {% endif %}

                                {% if has_next %}
                                    <li>
                                    <a href="{% url 'information_service' %}?data={{ code }}&page={{ next_page_number }}">
                                        > </a>
                                {% endif %}
                            </ul>
                        </div>
                    {% endblock %}
                    </div>
                {% endblock %}
            </div>
        </div>
    </div>
    <!-- 内容框end -->


{% endblock %}